import java.util.Scanner;

public class Work01 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        long[] nums = new long[n];
        long sum = 0;
        for(int i = 0; i < n;i++){
            nums[i] = scan.nextLong();
            sum += nums[i];
        }
        long res = 0;
        for(int i = 0 ;i< nums.length;i++){
            sum -= nums[i];
            res += nums[i] * (sum);
        }
        System.out.println(res);
        scan.close();
    }
}
